<?php
/**
 * Created by jinqiang on 2025/8/8 16:39.
 * Copyright (c) 2025, Your Company. All rights reserved.
 */


namespace App\Http\Controllers\Tool;


use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class UtilsController extends Controller
{
    public function getImg64(Request $request)
    {
        $this->validate($request, [
            'img' => 'required',
        ]);
        $param = $request->all();
        $imgExtension = pathinfo($param['img'], PATHINFO_EXTENSION);
        $img_64 = "data:image/{$imgExtension};base64,".base64_encode(file_get_contents($param['img']));
        return result($img_64);
    }
}
